-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvmPackages_14: Fix build on aarch64-linux #201485
Conversation
@ofborg eval |
Hmm I'm still getting
for |
@risicle you're right, I have added the same workaround for compiler-rt and clang. |
When building
According to llvm/llvm-project#56828 this happens with GCC 10, but works OK with GCC 11. |
Linking error again for |
@@ -26,6 +26,9 @@ let | |||
|
|||
buildInputs = [ libxml2 libllvm ]; | |||
|
|||
# workaround https://github.com/NixOS/nixpkgs/issues/201254 | |||
NIX_LDFLAGS = if stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU then "-lgcc" else null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider if adding an argument above like { withLibgcc ? stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU, ... }:
is better than putting these conditions inline in the body of derivations. This could make overriding LLVM easier and I think its self-documenting to have code in the form of effect ? cause
rather than if ${cause} then ${action} else null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is just an ugly workaround, I would prefer to keep this as ugly as possible. 😬
Fixed. I tried to use nixpkgs-review, but this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a TODO: The commit history needs to be cleaned up (one commit per logical change - currently there are basically a few fixup commits - I'd suggest to either put everything into one commit or one to fix the build and one for the -lgcc
changes (the latter would probably be better)).
Ideally this should also target llvmPackages_git
as well (normally that would be required but llvmPackages_git
is in bad shape since many PRs forget to target it and llvmPackages_15
already has a PR that is stuck in limbo...).
The libcxx library needs a C++20 capable compiler toolchain since version 14, but aarch64-linux uses GCC 9 by default. However, building libcxxabi fails when using GCC 10, see [llvm/llvm-project#56828]. So let's use GCC 11 instead. [llvm/llvm-project#56828]: llvm/llvm-project#56828
…r-rt and clang This is required to workaround NixOS#201254.
b93b4f6
to
176a7a3
Compare
@primeos I have rebased onto master and refined the commit history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks! :)
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
This can't go directly to master. OfBorg doesn't check this for aarch64-linux, but it is a large rebuild:
|
Bisected a broken In https://hydra.nixos.org/build/201827173 it fails >80 tests. |
Go ahead and revert my merge if it doesn't make things worse. |
} // lib.optionalAttrs (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux && buildPackages.stdenv.cc.isGNU) { | ||
stdenv = gcc11Stdenv; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails all the gold tests. Which is caused by:
Would it be feasible to disable the gold linker plugin on this platform? |
I don't really understand this, so I just reverted the whole PR for now. Otherwise |
This change switches to using GCC 11 by default on aarch64-linux, as well as passing `-lgcc` to the linker, per NixOS#201485. See NixOS#201254 and NixOS#208412 for wider context on the issue.
This change switches to using GCC 11 by default on aarch64-linux, as well as passing `-lgcc` to the linker, per NixOS#201485. See NixOS#201254 and NixOS#208412 for wider context on the issue. (cherry picked from commit 8442601)
Description of changes
This PR fixes building the LLVM packages on aarch64-linux.
The libcxx library needs a C++20 capable compiler toolchain since version 14.
Also, work around the linking problems described in #201254
ZHF: #199919
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes